package com.lvchen.common.view;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.lvchen.R;
import com.lvchen.common.utils.UIHelper;
import com.mingle.widget.LoadingView;

/**
 * Created by 律晨 on 2018/6/25.
 */
public class LoadingDialog extends Dialog {
    private int Id;
    private Context context;
    private Activity activity;
    private LoadingView loadview;


    public LoadingDialog(Context paramContext, int them, int layout) {
        super(paramContext, them);
        this.context = paramContext;
        this.Id = layout;
        this.activity = (Activity) context;
    }

    protected void onCreate(Bundle paramBundle) {
        super.onCreate(paramBundle);
        setContentView(this.Id);
        this.loadview = ((LoadingView) findViewById(R.id.loadview));

        this.loadview.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                UIHelper.CloseLoadingView();
            }
        });

    }

    public void setText(String paramString) {
        this.loadview.setLoadingText(paramString);
    }


    @Override
    public void dismiss(){
        if (activity != null &&!activity.isFinishing()){
            super.dismiss();    //调用超类对应方法
        }
    }


}
